package com.weijun.keepalivedemo.daemon

import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.weijun.keepalivedemo.R

/**
 * @author: weijun
 * date: 2023/7/10
 * description:
 */
class KeepAliveDaemonActivity :AppCompatActivity(R.layout.activity_keepalive_daemon) {

    @RequiresApi(Build.VERSION_CODES.M)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (!Settings.canDrawOverlays(this)) {
            val intent = Intent(
                Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                Uri.parse("package:$packageName")
            )
            startActivityForResult(intent, 10)
        }

    }
}